<?php

namespace app\api\model;

use app\common\enums\StatusEnum;

class LangClassReciteType extends \app\common\model\LangClassReciteType
{
    /**
     * 二级联动用到的背诵分类
     * @param $classId
     * @param $courseType
     * @param $reciteType
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function getType($classId, $courseType, $reciteType)
    {
        return static::field('id, name')
            ->where([
                'type' => $reciteType,
                'class_id' => $classId,
                'course_type' => $courseType,
                'status' => StatusEnum::ENABLED,
            ])
            ->group('id')
            ->select()
            ->toArray();
    }
}